import {
	URL
} from '@/config/index.js'
export default (porps) => {
	let httpDefaultOpts = {
		url: URL + porps.url,
		data: Object.assign({
			token: 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImE0NGJkYjk3LTU1NjgtNDAxZC04YTMxLWIzZDA2YzAzNzJmMiJ9.Z5Fu-dKtse4_FsBv0oLIvCTyNBdhqXtykz5QtqeVKR3VPx-XNe_m7erEOiA7B6x9FsmKu5xjzM_tPZkzTGl3SQ'
		}, porps.data),
		method: porps.method || 'POST',
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		},
	};
	return new Promise((resolve, reject) => {
		uni.request(httpDefaultOpts).then(res => {
			if (res.data.code == 200) {
				resolve(res.data)
			} else {
				reject(res.msg)
			}
		})
	})
}